
num = 5

# if条件
# if int(input('猜猜我是几？')) == num:
#     print('恭喜你，一次就猜对了！！')
# elif int(input('猜错了，再猜一次吧')) == num:
#     print('猜对了')
# elif int(input('猜错了，最后一次机会了')) == num:
#     print('恭喜你，最后一次猜对了！！')
# else:
#     print('没有机会啦！！')

# while循环
# num = 1

# while num < 10:
#     print('太小了！！')
#     num += 1
# print('恭喜你，长大了')

# sum = 0
# while num <= 100:
#     sum += num
#     num += 1
# print('1-100累加的和是：', sum)
# print(f'1-100累加的和是：{sum}', sum)

# 九九乘法表
# i = 1
# while i <= 9:
#     j = 1
#     while j <= i:
#         # end=''不要换行，通过\t制表符进行对齐
#         print(f'{j} * {i} = {i * j}\t', end='')
#         j += 1
#     i += 1
#     print()

# range(5) 获取一个数字序列
# for i in range(10):
#     print(i, end='\t')
# 不建议直接访问循环体中的变量，可以先提前定义好
# print(i)
#
# for j in range(5, 10):
#     print(j, end='\t')
#
# print()
#
# for j in range(5, 10, 2):
#     print(j, end='\t')

# 循环中断的关键字
# for j in range(5, 10, 2):
#     print(j, end='\t')
#     # continue
#     break

